import { pubRequire } from '@utils/public'
const baseUrl = '/live-rooms/window'
//橱窗列表
export function getSearchList(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callBack, errBack)
}
//新增配置
export function addWindow(obj, callBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callBack, errBack)
}
//修改状态
export function editStatus(obj, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/status/${obj.id}`, {}, callBack, errBack)
}
//删除配置
export function deleteWindow(obj, callBack, errBack) {
  return pubRequire('delete', `${baseUrl}/${obj.id}`, {}, callBack, errBack)
}
//配置详情
export function windowDetail(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/${obj.id}`, {}, callBack, errBack)
}
//修改配置
export function editWindow(id, obj, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}`, obj, callBack, errBack)
}
/* ****************************************************************** */
//商品货架列表
export function getCommodityList(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/commodity`, obj, callBack, errBack)
}
//修改商品状态
export function editCommodityStatus(obj, callBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/commodity/status/${obj.id}`,
    {},
    callBack,
    errBack
  )
}
//排序
export function editSort(id, formData, callBack, errBack) {
  return pubRequire(
    'patch',
    `${baseUrl}/commodity/sort/${id}`,
    formData,
    callBack,
    errBack
  )
}

//新增商品
export function addCommodity(obj, callBack, errBack) {
  return pubRequire('post', `${baseUrl}/commodity`, obj, callBack, errBack)
}
//商品详情
export function commodityDetail(obj, callBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/commodity/${obj.id}`,
    {},
    callBack,
    errBack
  )
}
//修改商品
export function editCommodity(id, obj, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/commodity/${id}`, obj, callBack, errBack)
}

//删除商品
export function deleteCommodity(obj, callBack, errBack) {
  return pubRequire(
    'delete',
    `${baseUrl}/commodity/${obj.id}`,
    {},
    callBack,
    errBack
  )
}
//推送
export function pushGoods(obj, callBack, errBack) {
  return pubRequire(
    'post',
    `${baseUrl}/commodity/push/${obj.id}`,
    {},
    callBack,
    errBack
  )
}
/* ********************************************************************************** */
//外部商品列表
export function getPromotionList(obj, callBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/commodity/promotion/link`,
    obj,
    callBack,
    errBack
  )
}
